package com.di;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.stereotype.Component;

@Component
public class Singer {
	
	@Autowired
	private Song song;
	
	public void singSong(){
		System.out.println("song");
		song.songDesc();
	}
	
	public static void main(String[] args) {
		//加载配置
		AnnotationConfigApplicationContext app = 
				new AnnotationConfigApplicationContext(new Class[]{AppConfig.class});
		//获取bean
		Singer s= app.getBean(Singer.class);
		
		s.singSong();
		
	}
}
